/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package Controleur;

import Modele.Grille;
import java.awt.event.KeyEvent;

/**
 *
 * @author Raphaël
 */
public class Controleur {

    public Grille tab;
    public Controleur(Grille tab) {
        super();
        build(tab);
    }

    public void build(Grille tab) {
        this.tab = tab;
    }
    
    public void partie(){
        this.tab.nouvellePartie();
    }
    
    public void pause(){
        this.tab.pause();
    }
    
    public void mouvement(int keycode){
        switch(keycode){
            case KeyEvent.VK_LEFT:
                    tab.MvtGauche();
                    break;
                case KeyEvent.VK_RIGHT:
                    tab.MvtDroite();
                    break;
                case KeyEvent.VK_UP:
                    tab.rotation();
                    break;
                case KeyEvent.VK_SPACE:
                    tab.tomber();
                    break;
                    case KeyEvent.VK_P:
                    pause();
                    break;
                        case KeyEvent.VK_N:
                    tab.nouvellePartie();
                    break;
                default:
                    tab.descendre();
                    break;
        }
    }
    
    
}
